<?php


namespace app\admin\validate;


use think\captcha\facade\Captcha;
use think\Validate;

class AdminValidate extends Validate
{
    protected $rule =   [
        'username|用户名'  => 'require|chsAlphaNum|length:3,30',
        'password|密码'   => 'require|length:6,30',
        'verifyCode|验证码'   => 'require|captcha',
        'email|邮箱' => 'email',
    ];

    protected $message  =   [
        'username.require' => '用户名必须填写',
        'username.chsAlphaNum'     => '用户名长度范围3-30个字符',
        'username.length'     => '用户名只能是汉字、字母和数字',
        'password.require'   => '密码必须填写',
        'password.length'   => '密码必须6-30个字符',
        'verifyCode.require'   => '验证码必须填写',
        'email'        => '邮箱格式错误',
    ];

    //验证场景
    protected $scene = [
        'login'=>['username','password','verifyCode']
    ];

}